<style lang="scss" scoped>
  .form {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    .el-form-item {
      width: 220px;
    }
  }
</style>
<template>
  <el-dialog :title="title" :visible.sync="editDialogVisible" width="35%">
    <div class="ui-box leave_dialog">
      <el-form :model="electricBillItem" label-width="100px" :rules="formRule" ref="form" class="form">
<!--        <el-form-item label="宿舍楼" prop="buildingNo">-->
<!--          <el-input size="mini" v-model="electricBillItem.buildingNo"></el-input>-->
<!--        </el-form-item>-->
<!--        <el-form-item label="宿舍号" prop="dorNo">-->
<!--          <el-input size="mini" v-model="electricBillItem.dorNo"></el-input>-->
<!--        </el-form-item>-->
          <el-form-item label="电费(元)" prop="electricBill">
                    <el-input size="mini" v-model="electricBillItem.dsElectricBill"></el-input>
                  </el-form-item>
                  <el-form-item label="电费用量(度)" prop="electricBillDetail">
                    <el-input size="mini" v-model="electricBillItem.dsElectricBillDetail"></el-input>
                  </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="editDialogVisible = false" size="mini">取 消</el-button>
        <el-button type="primary" @click="submit" size="mini">确 定</el-button>
      </div>
    </div>
  </el-dialog>
</template>
<script>
  export default {
    name: 'editItem',
    props: {
      electricBillItem: {
        // dorId: '',
        // buildingNo: '',
        dsElectricBill: '',
        dsElectricBillDetail:'',
      }
    },
    data() {
      return {
        formRule: {
          dsElectricBill: [{required: true, message: '请输入电费', trigger: 'blur'}],
          dsElectricBillDetail: [{required: true, message: '请输入电费用量', trigger: 'blur'}],
        },
        editDialogVisible: false,
        title: '',
      }
    },
    methods: {
      submit() {
        this.$refs['form'].validate((val) => {
          if (val) {
            this.$emit('submit')
          }
        })
      },
      openWindow(value, electricBillItem) {
        this.electricBillItem = electricBillItem;
        this.title = value;
        this.editDialogVisible = true;
      }
    }
  }
</script>

